<template>
  <div class="app-container">
    <search-box
      :fields="searchFeilds"
      @search="handleSearch"
      @add="handleAdd"
    />


    <SearchResult
      uid="systemSetting"
      ref="searchResult"
      :params="params"
      :ignoreCommand="ignoreCommand"
    >
      <el-table-column label="公司名称" align="left">
        <template slot-scope="{row}">
          <span>{{ row.companyName }}</span>
        </template>
      </el-table-column>

      <el-table-column label="客服电话" align="center">
        <template slot-scope="{row}">
          <span>{{ row.serviceTelephone }}</span>
        </template>
      </el-table-column>

      <el-table-column label="邮箱地址" align="center">
        <template slot-scope="{row}">
          <span>{{ row.emailAddress }}</span>
        </template>
      </el-table-column>

      <el-table-column label="联系地址" align="center">
        <template slot-scope="{row}">
          <span>{{ row.contactAddress }}</span>
        </template>
      </el-table-column>

      <el-table-column label="成立年份" align="center">
        <template slot-scope="{row}">
          <span>{{ row.setupYear }}</span>
        </template>
      </el-table-column>

      <el-table-column label="合作医院数量" align="center">
        <template slot-scope="{row}">
          <span>{{ row.joinHospitalQuantity }}</span>
        </template>
      </el-table-column>

      <el-table-column label="科研医院数量" align="center">
        <template slot-scope="{row}">
          <span>{{ row.scientificHospitalQuantity }}</span>
        </template>
      </el-table-column>

      <el-table-column label="行业荣耀数量" align="center">
        <template slot-scope="{row}">
          <span>{{ row.tradeGloryQuantity }}</span>
        </template>
      </el-table-column>
    </SearchResult>
  </div>
</template>
<script>
import SearchBox from '@/components/SearchBox';
import SearchResult from '@/components/SearchResult';
import cImage from '@/components/Image';

export default {
  name: 'system-setting',
  components: { SearchBox, SearchResult, cImage },
  data() {
    return {
      searchFeilds: [
        { name: 'CompanyName', label: '公司名称', type: 'text' },
        { name: 'ServiceTelephone', label: '客服电话', type: 'text' },
        { name: 'EmailAddress', label: '邮箱地址', type: 'text' },
        { name: 'ContactAddress', label: '联系地址', type: 'text' }
      ],

      ignoreCommand: ['enable', 'disable', 'detail'],
      params: {}
    };
  },
  methods: {
    // 搜索
    handleSearch(data) {
      if (data === void 0) data = {};

      this.params = data;
      this.$refs['searchResult'].getData(data);
    },

    // 添加
    handleAdd() {
      this.$refs['searchResult'].handleAdd();
    }
  }
}
</script>
